# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.BareMetalSolution.V2.Model.Network do
  @moduledoc """
  A Network.

  ## Attributes

  *   `cidr` (*type:* `String.t`, *default:* `nil`) - The cidr of the Network.
  *   `gatewayIp` (*type:* `String.t`, *default:* `nil`) - Output only. Gateway ip address.
  *   `id` (*type:* `String.t`, *default:* `nil`) - An identifier for the `Network`, generated by the backend.
  *   `ipAddress` (*type:* `String.t`, *default:* `nil`) - IP address configured.
  *   `jumboFramesEnabled` (*type:* `boolean()`, *default:* `nil`) - Whether network uses standard frames or jumbo ones.
  *   `labels` (*type:* `map()`, *default:* `nil`) - Labels as key value pairs.
  *   `macAddress` (*type:* `list(String.t)`, *default:* `nil`) - List of physical interfaces.
  *   `mountPoints` (*type:* `list(GoogleApi.BareMetalSolution.V2.Model.NetworkMountPoint.t)`, *default:* `nil`) - Input only. List of mount points to attach the network to.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The resource name of this `Network`. Resource names are schemeless URIs that follow the conventions in https://cloud.google.com/apis/design/resource_names. Format: `projects/{project}/locations/{location}/networks/{network}`
  *   `pod` (*type:* `String.t`, *default:* `nil`) - Immutable. Pod name. Pod is an independent part of infrastructure. Network can only be connected to the assets (instances, nfsshares) allocated in the same pod.
  *   `reservations` (*type:* `list(GoogleApi.BareMetalSolution.V2.Model.NetworkAddressReservation.t)`, *default:* `nil`) - List of IP address reservations in this network. When updating this field, an error will be generated if a reservation conflicts with an IP address already allocated to a physical server.
  *   `servicesCidr` (*type:* `String.t`, *default:* `nil`) - IP range for reserved for services (e.g. NFS).
  *   `state` (*type:* `String.t`, *default:* `nil`) - The Network state.
  *   `type` (*type:* `String.t`, *default:* `nil`) - The type of this network.
  *   `vlanId` (*type:* `String.t`, *default:* `nil`) - The vlan id of the Network.
  *   `vrf` (*type:* `GoogleApi.BareMetalSolution.V2.Model.VRF.t`, *default:* `nil`) - The Vrf for the Network. Use this only if a new Vrf needs to be created.
  *   `vrfAttachment` (*type:* `String.t`, *default:* `nil`) - Optional. The name of a pre-existing Vrf that the network should be attached to. Format is `vrfs/{vrf}`.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :cidr => String.t() | nil,
          :gatewayIp => String.t() | nil,
          :id => String.t() | nil,
          :ipAddress => String.t() | nil,
          :jumboFramesEnabled => boolean() | nil,
          :labels => map() | nil,
          :macAddress => list(String.t()) | nil,
          :mountPoints => list(GoogleApi.BareMetalSolution.V2.Model.NetworkMountPoint.t()) | nil,
          :name => String.t() | nil,
          :pod => String.t() | nil,
          :reservations =>
            list(GoogleApi.BareMetalSolution.V2.Model.NetworkAddressReservation.t()) | nil,
          :servicesCidr => String.t() | nil,
          :state => String.t() | nil,
          :type => String.t() | nil,
          :vlanId => String.t() | nil,
          :vrf => GoogleApi.BareMetalSolution.V2.Model.VRF.t() | nil,
          :vrfAttachment => String.t() | nil
        }

  field(:cidr)
  field(:gatewayIp)
  field(:id)
  field(:ipAddress)
  field(:jumboFramesEnabled)
  field(:labels, type: :map)
  field(:macAddress, type: :list)
  field(:mountPoints, as: GoogleApi.BareMetalSolution.V2.Model.NetworkMountPoint, type: :list)
  field(:name)
  field(:pod)

  field(:reservations,
    as: GoogleApi.BareMetalSolution.V2.Model.NetworkAddressReservation,
    type: :list
  )

  field(:servicesCidr)
  field(:state)
  field(:type)
  field(:vlanId)
  field(:vrf, as: GoogleApi.BareMetalSolution.V2.Model.VRF)
  field(:vrfAttachment)
end

defimpl Poison.Decoder, for: GoogleApi.BareMetalSolution.V2.Model.Network do
  def decode(value, options) do
    GoogleApi.BareMetalSolution.V2.Model.Network.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.BareMetalSolution.V2.Model.Network do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
